package jsen.tool.ddd.demo.adapter.persistent;

import jsen.tool.ddd.adapter.infrastructure.specification.ISpecification;
import jsen.tool.ddd.demo.domain.brand.Brand;
import jsen.tool.ddd.demo.domain.brand.BrandRepo;

import java.util.List;

/**
 * @author jsen
 * @date 2021/9/30
 */
public class BrandRepository implements BrandRepo {
    private BrandDao brandDao;

    @Override
    public Brand loadById(Long id) {
        return new BrandAssemble().brand(brandDao.get(id));
    }

    /**
     * 考虑ISpecification是否合适
     */
    @Override
    public List<Brand> query(ISpecification<Brand> specification) {
        return new BrandAssemble().brand(brandDao.query());
    }
}
